import { FormState } from "./ChartForm";
import { ChartFormItemContext } from "./ChartFormItem";

export enum EChartFormItem {
    Input = "InputItem",
    Select = "SelectItem",
    Limit = "LimitItem"
}

export interface IMateData {
    name: string,
    label: string,
    originType: string,
    frontEndType: string;
}
export enum EMateDataType {
    Number = 'number',
    String = 'string',
    ALL = '*'
}
export interface IChartFormItem {
    /**
     * 表单项的文字标题
     */
    label?: string;
    value?: any;
    placeHolder?: string;
    datas?: any;
    isMultiple?: boolean;
    name?: string;
    shouldRender?: boolean;
    type?: EChartFormItem;
    default?: any;
    computed?: any;
    disabled?: boolean;
    mateData?: {
        type: EMateDataType
    };
    /**
     * @description 配置项的说明，如果该配置项需要补充说明文字，会通过该项显示
     */
    description?: string;
}

export type TuseComputedFn = (props: ChartFormItemContext[] | ChartFormItemContext, effectFn: () => any) => FormState<any>;
export type TinjectFn = (props: string[] | string) => Array<ChartFormItemContext>